<%@page import="org.esgi.model.interfaces.IForm"%>
<%@page import="org.esgi.dao.FormDao"%>
<%@page import="java.util.ArrayList"%>

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%
ArrayList<IForm> formList = (ArrayList<IForm>) request.getAttribute("formList");
String servletUrl = (String) request.getAttribute("servletUrl");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="headers.jsp"%>
<title>Liste des Formulaires</title>
</head>
<body>
<br/>
	<%@include file="navBar.jsp" %>
	<div class="listTable well">
	<%
	if (formList != null && !formList.isEmpty() ){
		out.write("<table>");
			out.write("<tr>");
				out.write("<td style=\"width:300px\">");
					out.write("Nom du formulaire");
				out.write("</td>");
				out.write("<td style=\"width:100px\">");
					out.write("Questions");
				out.write("</td>");
				out.write("<td>");
					out.write("Supprimer");
				out.write("</td>");
			out.write("</tr>");
 		for(IForm form : formList){
 			out.write("<tr>");
 			out.write("<td><a href=\""+servletUrl+"/formDetail?form_id="+form.getId()+"\" > "+form.getName()+"</a></td>");
 			out.write("<td>"+form.getQuestions().size()+"</td>");
 	 		out.write("<td><a href=\""+servletUrl+"/form_delete?form_id="+form.getId()+"\" class=\"icon-remove-sign\"></a></td>");
 	 		out.write("</tr>");
 		}		
 		out.write("</table>");
 	}else
 	{
 		out.write("<div>Pas de formulaires</div>");
 	}
	%>
	</div>
</body>
</html>